/*路由配置*/
import { createRouter, createWebHistory } from 'vue-router';
import Home from '../views/Home.vue';
import ProductDetail from '../views/ProductDetail.vue';
import Cart from '../views/Cart.vue';
import User from '../views/User.vue';
import Settings from '../views/Settings.vue';

//const router = createRouter({
  //history: createWebHistory(),
  const routes=[
    {     /*首页*/
      path: '/',       /*访问路径*/
      name: 'home',    /*路由名称*/
      component: Home   /*对应的 Vue 组件*/
    },
    {      /*商品详情页*/
      path: '/product/:id',
      name: 'product-detail',
      component: ProductDetail
    },
    {      /*购物车页面*/
      path: '/cart',
      name: 'cart',
      component: Cart
    },
    {     /*用户页面*/
      path: '/user',
      name: 'user',
      component: User
    },
    {    /*设置页面*/
      path: '/settings',
      name: 'settings',
      component: Settings
    }
  ]
  const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router 